package com.dwyinyuan.factory;

import com.dwyinyuan.enums.ProviderEnums;
import com.dwyinyuan.producer.*;

import java.util.concurrent.BlockingQueue;

public class SpiderFactory {

    public Runnable getProducer(String providerType, BlockingQueue<String> blockingQueue) {
        if (ProviderEnums.FENG_NIAO.getName().equals(providerType)) {
            return new FengniaoProducer("Producer", blockingQueue);
        } else if (ProviderEnums.HUA_SHI_6.getName().equals(providerType)) {
            return new Huashi6Producer("Producer", blockingQueue);
        } else if (ProviderEnums.MEI_NV_LA.getName().equals(providerType)) {
            return new MeinvlaProducer("Producer", blockingQueue);
        } else if (ProviderEnums.TANG_YUN_365.getName().equals(providerType)) {
            return new Tangyun365Producer("Producer", blockingQueue);
        } else if (ProviderEnums.WALL_HAVEN.getName().equals(providerType)) {
            return new WallHavenProducer("Producer", blockingQueue);
        } else if (ProviderEnums.WIN_4000.getName().equals(providerType)) {
            return new Win4000Producer("Producer", blockingQueue);
        } else {
            throw new RuntimeException("未找到对应的生产者。。。");
        }
    }
}
